class Song < ActiveRecord::Base
  
  #has_many :items, :class_name => 'PlaylistItem'
  #has_many :playlists, :through => :playlist_items
  has_many :votes
  
  def self.sync_with_mpd()
    MiddleMan.ask_work(:worker => :mpd_sync_worker, :worker_method => :sync)
  end
  
  def self.update_progress
    MiddleMan.ask_status(:worker => :mpd_sync_worker)
  end
  
  def add_to_playlist
    p = PlaylistItem.new(:playlist_id => Jukebox.playlist.id, :song_id => self.id)
    p.save
  end
end